var app = getApp();

Page({
    data: {
        isLogin: !1,
        imgPath: app.getImgUrl(),
        task_text: !1
    },
    onLoad: function(t) {
        this.setData({
            navH: app.globalData.navHeight
        }), app.globalData.setting.task_7_text && this.setData({
            task_text: app.globalData.setting.task_7_text
        });
        var a = !!app.globalData.userInfo;
        this.setData({
            isLogin: a
        }), app.checkUserSub(2);
    },
    navBack: function() {
        wx.navigateBack();
    },
    toIndex: function() {
        wx.switchTab({
            url: "../index/index"
        });
    },
    loginAfter: function(t) {
        app.loginAfter(t);
    },
    loginCancel: function() {
        app.loginCancel();
    },
    sharetoFq: function() {
        app.checkLogin();
    },
    saveUserPoster: function() {
        app.globalData.userInfo ? app.util.request({
            url: "entry/wxapp/getUserPoster",
            success: function(t) {
                console.log(t), t = t.data.data, console.log(t), wx.getImageInfo({
                    src: t,
                    success: function(t) {
                        wx.saveImageToPhotosAlbum({
                            filePath: t.path,
                            success: function(t) {
                                wx.showToast({
                                    title: "已保存至相册",
                                    icon: "success"
                                });
                            },
                            fail: function(t) {
                                wx.showModal({
                                    title: "系统提示",
                                    content: "请转至“授权设置”页面打开“保存到相册”开关",
                                    confirmColor: "#f43f6c",
                                    confirmText: "去打开",
                                    showCancel: !1,
                                    success: function(t) {
                                        wx.openSetting({
                                            withSubscriptions: !0,
                                            success: function() {}
                                        });
                                    }
                                });
                            }
                        });
                    }
                });
            }
        }) : app.checkLogin();
    },
    onReady: function() {},
    onShow: function() {
        app.reUserInfo();
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {
        var t = app.globalData.setting.share_title || "购物省钱，分享赚钱", a = app.globalData.setting.share_pic;
        return {
            title: t,
            path: "/first_duoduoke/pages/index/index" + (void 0 !== app.globalData.userInfo.uid ? "?from_uid=" + app.globalData.userInfo.uid + "&from_act=share" : ""),
            imageUrl: a,
            success: function(t) {
                "shareAppMessage:ok" == t.errMsg ? wx.showToast({
                    title: "分享成功",
                    icon: "success"
                }) : wx.showToast({
                    title: "分享失败",
                    icon: "none"
                });
            },
            fail: function(t) {
                "shareAppMessage:fail cancel" == t.errMsg || t.errMsg, wx.showToast({
                    title: "分享失败",
                    icon: "none"
                });
            }
        };
    }
});